package com.yl.pattern.behavioralmodel.iterator;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author 小羊
 * @Date 1/11/2024下午 4:15
 * @ClassName StudentAggregateImpl
 * @Description StudentAggregateImpl
 */
public class StudentAggregateImpl implements StudentAggregate{
    private List<Student> list = new ArrayList<>();
    @Override
    public void addStudent(Student stu) {
        list.add(stu);
    }

    @Override
    public void removeStudent(Student stu) {
        list.remove(stu);
    }

    @Override
    public StudentIterator getStudentIterator() {
        return new StudentIteratorImpl(list);
    }
}
